import { Controller, Get, Post, Put, Body, Query, Param, Delete } from '@nestjs/common';
import { ApiTags, ApiOperation } from '@nestjs/swagger';
import { RequirePermission } from 'src/common/decorators/require-premission.decorator';
import { ClockService } from './clock.service';
import { CreateClockDto, BaseClockDto, UpdateClockDto, QueryClockDto, ListClockDto } from './dto/clock.dto';
import { ApiDataResponse } from 'src/common/decorators/apiDataResponse.decorator';

@ApiTags('闹钟表，存储用户设置的各类闹钟信息')
@Controller('system/clock')
export class ClockController {
  constructor(private readonly clockService: ClockService) {}

  @ApiOperation({ summary: '闹钟表，存储用户设置的各类闹钟信息-创建' })
  @ApiDataResponse(BaseClockDto)
  // @RequirePermission('system:clock:add')
  @Post()
  create(@Body() body: CreateClockDto) {
    return this.clockService.create(body);
  }

  @ApiOperation({ summary: '闹钟表，存储用户设置的各类闹钟信息-列表' })
  @ApiDataResponse(ListClockDto, true, true)
  // @RequirePermission('system:clock:list')
  @Get('list')
  findAll(@Query() query: QueryClockDto) {
    return this.clockService.findAll(query);
  }

  @ApiOperation({ summary: '闹钟表，存储用户设置的各类闹钟信息-详情' })
  @ApiDataResponse(BaseClockDto)
  @RequirePermission('system:clock:query')
  @Get(':id')
  findOne(@Param('id') id: number) {
    return this.clockService.findOne(id);
  }

  @ApiOperation({ summary: '闹钟表，存储用户设置的各类闹钟信息-修改' })
  @ApiDataResponse()
  // @RequirePermission('system:clock:edit')
  @Put()
  update(@Body() body: UpdateClockDto) {
    return this.clockService.update(body);
  }

  @ApiOperation({ summary: '闹钟表，存储用户设置的各类闹钟信息-删除' })
  @ApiDataResponse()
  // @RequirePermission('system:clock:remove')
  @Delete(':id')
  remove(@Param('id') id: number) {
    return this.clockService.remove(id);
  }
}
